package com.cb.kfc.domain;

import com.cb.kfc.utils.DateUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 订单类
 */
public class Orders {
    private String id;//主键
    private String orderNum;//订单编号
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    private Date orderTime;//订单时间
    private String orderTimeStr;//订单时间转化的字符串
    private Product product;//会员类别类
    private List<Friend> friend;//会员的亲友信息集合
    private Member member;//会员的本人信息
    private String orderDesc;//订单描述
    private String productId;
    private String memberId;

//    @Override
//    public String toString() {
//        return "Orders{" +
//                "id='" + id + '\'' +
//                ", orderNum='" + orderNum + '\'' +
//                ", orderTime=" + orderTime +
//                ", orderTimeStr='" + orderTimeStr + '\'' +
//                ", product=" + product.toString() +
//                ", friend=" + friend +
//                ", member=" + member.toString() +
//                ", orderDesc='" + orderDesc + '\'' +
//                ", productId='" + productId + '\'' +
//                ", memberId='" + memberId + '\'' +
//                '}';
//    }

    public List<Friend> getFriend() {
        return friend;
    }

    public void setFriend(List<Friend> friend) {
        this.friend = friend;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderTimeStr() {
        if(orderTime != null){
            orderTimeStr = DateUtils.date2String(orderTime,"yyyy-MM-dd HH-mm-ss");
        }
        return orderTimeStr;
    }

    public void setOrderTimeStr(String orderTimeStr) {
        this.orderTimeStr = orderTimeStr;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }


    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public String getOrderDesc() {
        return orderDesc;
    }

    public void setOrderDesc(String orderDesc) {
        this.orderDesc = orderDesc;
    }
}
